//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;

namespace OpenLS.Chart.UI
{
    class OrientationToBooleanConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            AxisOrientation o = (AxisOrientation) value;
            switch (o)
            {
                case AxisOrientation.MinimumToMaximum:
                    return false;
                case AxisOrientation.MaximumToMinimum:
                    return true;
                default:
                    throw new NotSupportedException();
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            bool b = (bool) value;
            if (b)
                return AxisOrientation.MaximumToMinimum;
            return AxisOrientation.MinimumToMaximum;
        }

        #endregion
    }
}
